import { request } from "@/utils/service"
import type * as operationRecord from "./types/operationRecord"

// #region 操作记录相关接口
/** 创建操作记录 */
export function createOperationRecordApi(data: operationRecord.OperationRecordCreateData) {
  return request({
    url: "/OperationRecord/create",
    method: "post",
    data
  })
}

/** 获取操作记录列表 */
export function getOperationRecordListApi(params: operationRecord.OperationRecordRequestData) {
  return request<operationRecord.OperationRecordResponseData>({
    url: "/OperationRecord/list",
    method: "get",
    params
  })
}

/** 获取操作记录详情 */
export function getOperationRecordDetailsApi(params: operationRecord.OperationRecordDetailRequestData) {
  return request<operationRecord.OperationRecordDetailResponseData>({
    url: "/OperationRecord/getDetails",
    method: "get",
    params
  })
}

/** 删除操作记录 */
export function deleteOperationRecordApi(params: operationRecord.OperationRecordDeleteData) {
  return request({
    url: "/OperationRecord/delete",
    method: "delete",
    params
  })
}

/** 批量删除操作记录 */
export function batchDeleteOperationRecordApi(data: operationRecord.OperationRecordBatchDeleteData) {
  return request({
    url: "/OperationRecord/batchDelete",
    method: "delete",
    data
  })
}

/** 清空指定时间前的历史记录 */
export function clearBeforeOperationRecordApi(params: operationRecord.OperationRecordClearBeforeData) {
  return request({
    url: "/OperationRecord/clearBefore",
    method: "delete",
    params
  })
}

/** 获取操作统计信息 */
export function getOperationStatisticsApi() {
  return request<operationRecord.OperationRecordStatisticsResponseData>({
    url: "/OperationRecord/statistics",
    method: "get"
  })
}

/** 快速记录操作日志 */
export function logOperationApi(data: operationRecord.OperationRecordLogData) {
  return request({
    url: "/OperationRecord/log",
    method: "post",
    data
  })
}

/** 获取操作类型选项 */
export function getOperationTypeOptionsApi() {
  return request<operationRecord.OperationTypeOptionsResponseData>({
    url: "/OperationRecord/getTypeOptions",
    method: "get"
  })
}
// #endregion
